package juc.c_000;/*
   Talk is cheap. Show me the code.
 */

/**
 * @Description
 * @Date 2021/6/6
 * @Author liudl
 */
public class T02_HowToCreateThread {
    /**
     * 1、继承Thread类，重写run方法
     */
    static class MyThread extends Thread {
        @Override
        public void run() {
            System.out.println("MyThread!");
        }
    }

    /**
     * 2、实现Runnable接口
     */
    static class MyRun implements Runnable {
        @Override
        public void run() {
            System.out.println("MyRun");
        }
    }

    public static void main(String[] args) {
        new MyThread().start();
        new Thread(new MyRun()).start();
        /**
         * 3、lambda表达式（第二种的变形）
         */
        new Thread(()->{
            System.out.println("Lambda");
        }).start();
    }
}
